package com.loiot.baqi.dao;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

import org.apache.commons.lang.StringUtils;
import org.mybatis.spring.support.SqlSessionDaoSupport;
import org.springframework.stereotype.Repository;

import com.loiot.baqi.pojo.WeiAccountQqGroupBusiness;

/**
 * 商务谈判 访问层。
 * 
 * @author  wangzx 
 * @creation 2016-08-11
 */
@Repository("weiAccountQqGroupBusinessDao")
public class WeiAccountQqGroupBusinessDao extends SqlSessionDaoSupport{
    
    /**
     * 添加 商务谈判
     * 
     * @param p 参数对象
     */
    public WeiAccountQqGroupBusiness addWeiAccountQqGroupBusiness(WeiAccountQqGroupBusiness p)throws Exception {
        this.getSqlSession().insert("WeiAccountQqGroupBusiness.addWeiAccountQqGroupBusiness", p);
        return p;
    }
    
    /**
     * 修改 商务谈判
     * 
     * @param p 参数对象
     */
    public void updateWeiAccountQqGroupBusiness(WeiAccountQqGroupBusiness p)throws Exception {
        this.getSqlSession().update("WeiAccountQqGroupBusiness.updateWeiAccountQqGroupBusiness", p);
    }
    
    /**
     * 修改 商务谈判
     * 
     * @param p 参数对象
     */
    public void updateWeiAccountQqGroupBusiness(HashMap<String,Object> pMap)throws Exception {
        this.getSqlSession().update("WeiAccountQqGroupBusiness.updateWeiAccountQqGroupBusinessByMap", pMap);
    }
    
    
    
    /**
     * 删除  商务谈判
     * 
     * @param id 主键
     */
    public void deleteWeiAccountQqGroupBusiness(java.lang.Long id)throws Exception {
        getSqlSession().delete("WeiAccountQqGroupBusiness.deleteWeiAccountQqGroupBusiness", id);
    }
    
    /**
     * 删除  商务谈判
     * 
     * @param id 主键
     */
    public void deleteWeiAccountQqGroupBusiness(WeiAccountQqGroupBusiness p)throws Exception {
        getSqlSession().delete("WeiAccountQqGroupBusiness.deleteWeiAccountQqGroupBusiness", p);
    }
    
    /**
     * 获得  商务谈判
     * 
     * @param id 商务谈判Id
     * 
     * @return 返回与ID匹配的商务谈判
     */
    public WeiAccountQqGroupBusiness getWeiAccountQqGroupBusinessById(java.lang.Long id)throws Exception {
    	HashMap<String, Object> pMap = new HashMap<String, Object>();
    	pMap.put("lisLeaderCooperationEnd", id);
    	return (WeiAccountQqGroupBusiness) getSqlSession().selectOne("WeiAccountQqGroupBusiness.getWeiAccountQqGroupBusinessById", pMap);
    }
    
    /**
     * 获得  商务谈判
     * 
     * @param id 商务谈判Id
     * 
     * @return 返回与ID匹配的商务谈判
     */
    public WeiAccountQqGroupBusiness getWeiAccountQqGroupBusinessById(java.lang.Long id,Long accountId)throws Exception {
    	HashMap<String, Object> pMap = new HashMap<String, Object>();
    	pMap.put("lisLeaderCooperationEnd", id);
    	pMap.put("inPerson", accountId);
    	return (WeiAccountQqGroupBusiness) getSqlSession().selectOne("WeiAccountQqGroupBusiness.getWeiAccountQqGroupBusinessById", pMap);
    }
    
    /**
     * 获得  商务谈判
     * 
     * @param id 商务谈判Id
     * 
     */
    public WeiAccountQqGroupBusiness getWeiAccountQqGroupBusiness(HashMap<String,Object> pMap)throws Exception {
    	return (WeiAccountQqGroupBusiness) getSqlSession().selectOne("WeiAccountQqGroupBusiness.queryWeiAccountQqGroupBusinessList", pMap);
    }
    
    /**
     * 获得  商务谈判
     * 
     * @param name 商务谈判名称
     * 
     * @return 返回与NAME匹配的商务谈判
     */
    public WeiAccountQqGroupBusiness getWeiAccountQqGroupBusinessByName(String name)throws Exception {
        return null;
        //return (WeiAccountQqGroupBusiness) getSqlSession().selectOne("WeiAccountQqGroupBusiness.getWeiAccountQqGroupBusinessByName", name);
    }
    
    
    
    /**
     * 查询 商务谈判列表
     * 
     * @param name 商务谈判名称
     * @param skipResults 跳过的记录数
     * @param maxResults 最大的记录数
     * @return 商务谈判列表
     */
    public List<WeiAccountQqGroupBusiness> queryWeiAccountQqGroupBusinessOverviewList(HashMap<String, Object> pMap, int skipResults, int maxResults)throws Exception {
    	pMap.put("skipResults", skipResults);
    	pMap.put("maxResults", maxResults);
        return getSqlSession().selectList("WeiAccountQqGroupBusiness.queryWeiAccountQqGroupBusinessOverviewList", pMap);
    }
    
    /**
     * 查询概览数
     * @param pMap
     * @return
     * @throws Exception
     */
    public int getWeiAccountQqGroupBusinessOverviewListCount(HashMap<String,Object> pMap)throws Exception {
        return (Integer) getSqlSession().selectOne("WeiAccountQqGroupBusiness.queryWeiAccountQqGroupBusinessOverviewCount", pMap);
    }
    
    /**
     * 查询  商务谈判列表条数
     * 
     * @param name 商务谈判名称
     * @return 商务谈判列表条数
     */
    
    public int getWeiAccountQqGroupBusinessListCount(HashMap<String,Object> pMap)throws Exception {
        return (Integer) getSqlSession().selectOne("WeiAccountQqGroupBusiness.getWeiAccountQqGroupBusinessListCount", pMap);
    }

    /**
     * 查询 商务谈判列表
     * 
     * @param name 商务谈判名称
     * @param skipResults 跳过的记录数
     * @param maxResults 最大的记录数
     * @return 商务谈判列表
     */
    public List<WeiAccountQqGroupBusiness> queryWeiAccountQqGroupBusinessList(HashMap<String, Object> pMap, int skipResults, int maxResults)throws Exception {
    	pMap.put("skipResults", skipResults);
    	pMap.put("maxResults", maxResults);
        return getSqlSession().selectList("WeiAccountQqGroupBusiness.queryWeiAccountQqGroupBusinessList", pMap);
    }
    
    /**
     * 查询 商务谈判列表
     * 
     * @param pMap 参数列表
     */
    public List<WeiAccountQqGroupBusiness> queryWeiAccountQqGroupBusinessList(HashMap<String, Object> pMap)throws Exception {
        return getSqlSession().selectList("WeiAccountQqGroupBusiness.queryWeiAccountQqGroupBusinessList", pMap);
    }
    
    /**
     * 查询 商务谈判列表
     * 
     * @return 商务谈判列表
     */
    public List<WeiAccountQqGroupBusiness> queryWeiAccountQqGroupBusinessList()throws Exception {
        Map<String, Object> params = new HashMap<String, Object>();
        return getSqlSession().selectList("WeiAccountQqGroupBusiness.queryWeiAccountQqGroupBusinessList",params);
    }
    
    /**
     * 查询 商务谈判列表
     * 
     * @return 商务谈判列表
     */
    public List<WeiAccountQqGroupBusiness> queryWeiAccountQqGroupBusinessList(WeiAccountQqGroupBusiness p )throws Exception {
        return getSqlSession().selectList("WeiAccountQqGroupBusiness.queryWeiAccountQqGroupBusinessList",p);
    }
    
    /**
     * 统计 商务谈判列表
     * 
     * @return 商务谈判列表
     */
    public List<HashMap<String,Object>> statisticsWeiAccountQqGroupBusinessInfo(HashMap<String, Object> pMap )throws Exception {
    	List<HashMap<String,Object>> p = null; 
    	p =(List)getSqlSession().selectList("WeiAccountQqGroupBusiness.statisticsWeiAccountQqGroupBusinessInfo",p);
    	return p;
    }
    
    
    
    

}
